<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>太阳返照盘 | 星盘</title>
    <style>
        /* 基础样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            /* 禁用移动端点击蒙层效果 */
            -webkit-tap-highlight-color: transparent;
            tap-highlight-color: transparent;
            outline: none;
        }

        /* 为可点击元素添加特定样式 */
        button,
        [class$="-btn"],
        a,
        [role="button"] {
            /* 禁用移动端点击蒙层效果 */
            -webkit-tap-highlight-color: transparent;
            tap-highlight-color: transparent;
            /* 防止文本选择 */
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            outline: none;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #0a0e17;
            color: #ffffff;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 20px;
            overflow-x: hidden;
            overflow-y: auto;
        }

        /* iframe中body的特殊样式 */
        body.in-iframe {
            padding: 10px;
        }

        /* 隐藏所有元素的滚动条但允许滚动 */
        html {
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE and Edge */
        }

        body {
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE and Edge */
        }

        /* Chrome, Safari and Opera */
        html::-webkit-scrollbar,
        body::-webkit-scrollbar {
            display: none;
        }

        /* 确保所有可滚动元素也隐藏滚动条 */
        * {
            scrollbar-width: none; /* Firefox */
        }

        *::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }

        /* 页面标题 */
        header {
            text-align: center;
            margin-bottom: 30px;
            z-index: 10;
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #1dd1a1, #c8d6e5);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            background-size: 300% 300%;
            animation: gradient 15s ease infinite;
        }

        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        .subtitle {
            font-size: 1.1rem;
            color: #b2bec3;
            margin-bottom: 20px;
        }

        /* 出生信息表单 */
        .birth-info-form {
            background: rgba(17, 24, 39, 0.8);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            padding: 20px;
            margin-bottom: 30px;
            width: 100%;
            max-width: 600px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        }

        .form-row {
            display: flex;
            gap: 15px;
            margin-bottom: 15px;
            flex-wrap: wrap;
        }

        .form-group {
            flex: 1;
            min-width: 200px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #dfe6e9;
            font-size: 0.9rem;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 8px;
            background: rgba(30, 41, 59, 0.7);
            color: #ffffff;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        .form-group input:focus {
            border-color: #3b82f6;
            background: rgba(30, 41, 59, 0.9);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }

        .calculate-btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #3b82f6, #1d4ed8);
            border: none;
            border-radius: 8px;
            color: #ffffff;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 10px;
        }

        .calculate-btn:hover {
            background: linear-gradient(135deg, #2563eb, #1e40af);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        }

        .calculate-btn:active {
            transform: translateY(0);
        }

        /* 星盘容器 */
        .chart-container {
            position: relative;
            width: 100%;
            max-width: 600px;
            aspect-ratio: 1 / 1;
            margin-bottom: 30px;
        }

        .chart-base {
            position: absolute;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background: rgba(17, 24, 39, 0.8);
            border: 2px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        }

        /* 星盘环 */
        .houses-ring,
        .zodiac-ring,
        .planets-ring {
            position: absolute;
            border-radius: 50%;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .houses-ring {
            width: 95%;
            height: 95%;
        }

        .zodiac-ring {
            width: 80%;
            height: 80%;
        }

        .planets-ring {
            width: 65%;
            height: 65%;
        }

        /* 扇区 */
        .house,
        .zodiac-sector {
            position: absolute;
            width: 100%;
            height: 100%;
            clip-path: polygon(50% 50%, 100% 0, 100% 100%);
            transform-origin: center;
            transition: all 0.3s ease;
        }

        .zodiac-sector {
            opacity: 0.3;
        }

        .zodiac-sector:hover {
            opacity: 0.5;
            cursor: pointer;
        }

        /* 星座 */
        .zodiac-sign {
            position: absolute;
            transform-origin: center;
            font-size: 0.9rem;
            color: #ffffff;
            text-align: center;
            font-weight: 600;
            transition: all 0.3s ease;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        }

        /* 行星 */
        .planet {
            position: absolute;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
            color: white;
        }

        .planet:hover {
            transform: translate(-50%, -50%) scale(1.2);
            filter: brightness(1.2);
        }

        /* 星盘中心 */
        .chart-center {
            position: absolute;
            width: 20%;
            height: 20%;
            border-radius: 50%;
            background: rgba(59, 130, 246, 0.2);
            border: 2px solid rgba(59, 130, 246, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            font-weight: bold;
            color: #ffffff;
        }

        /* 方向标记 */
        .direction {
            position: absolute;
            font-weight: bold;
            color: #3b82f6;
            text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
        }

        .direction-north {
            top: 5px;
            left: 50%;
            transform: translateX(-50%);
        }

        .direction-south {
            bottom: 5px;
            left: 50%;
            transform: translateX(-50%);
        }

        .direction-east {
            right: 5px;
            top: 50%;
            transform: translateY(-50%);
        }

        .direction-west {
            left: 5px;
            top: 50%;
            transform: translateY(-50%);
        }

        /* 信息面板 */
        .info-content {
            background: rgba(17, 24, 39, 0.8);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            padding: 20px;
            margin-top: 30px;
            width: 100%;
            max-width: 600px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .info-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            overflow-x: auto;
            padding-bottom: 10px;
        }

        .info-tab {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: white;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
            white-space: nowrap;
        }

        .info-tab:hover {
            background: rgba(59, 130, 246, 0.3);
        }

        .info-tab.active {
            background: rgba(59, 130, 246, 0.8);
            border-color: #3b82f6;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        .info-header {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            padding-bottom: 10px;
        }

        .info-icon {
            font-size: 2rem;
            margin-right: 15px;
        }

        .info-title {
            flex-grow: 1;
        }

        .info-name {
            font-size: 1.5rem;
            margin-bottom: 5px;
        }

        .info-details {
            color: #b2bec3;
            font-size: 0.9rem;
        }

        .info-text {
            font-size: 1rem;
            line-height: 1.6;
            color: #e9ecef;
            margin-bottom: 15px;
        }

        /* 信息卡片样式 */
        .info-card {
            background: rgba(255, 255, 255, 0.05);
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 15px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            transition: all 0.3s ease;
        }

        .info-card:hover {
            background: rgba(255, 255, 255, 0.08);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        .info-card-title {
            font-size: 1.2rem;
            margin-bottom: 10px;
            font-weight: 600;
        }

        /* 星星背景 */
        .stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }

        .star {
            position: absolute;
            background-color: white;
            border-radius: 50%;
            animation: twinkle 2s infinite alternate;
        }

        @keyframes twinkle {
            from { opacity: 0.3; }
            to { opacity: 1; }
        }

        /* 控制按钮 */
        .controls {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            justify-content: center;
            flex-wrap: wrap;
        }

        .control-btn {
            padding: 8px 16px;
            background: rgba(59, 130, 246, 0.2);
            border: 1px solid rgba(59, 130, 246, 0.5);
            border-radius: 6px;
            color: #ffffff;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
        }

        .control-btn:hover {
            background: rgba(59, 130, 246, 0.3);
            transform: translateY(-2px);
        }

        .control-btn:active {
            transform: translateY(0);
        }

        /* 行星图标 */
        .planet-icon {
            width: 24px;
            height: 24px;
            display: inline-block;
            margin-right: 5px;
            vertical-align: middle;
        }

        /* 响应式调整 */
        @media (max-width: 768px) {
            h1 {
                font-size: 2rem;
            }

            .birth-info-form {
                padding: 15px;
            }

            .form-row {
                flex-direction: column;
                gap: 10px;
            }

            .form-group {
                min-width: 100%;
            }

            .controls {
                flex-direction: column;
                align-items: center;
            }

            .control-btn {
                width: 100%;
                max-width: 200px;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 10px;
            }

            h1 {
                font-size: 1.8rem;
            }

            .subtitle {
                font-size: 1rem;
            }

            .chart-container {
                max-width: 350px;
            }

            .controls,
            .controls-row {
                gap: 5px;
            }
        }
    </style>
</head>
<body>
    <!-- 星星背景 (将通过JS动态生成) -->
    <div class="stars"></div>

    <header>
        <h1>太阳返照盘</h1>
        <p class="subtitle">探索太阳每年回到出生位置时的星盘格局，了解未来一年的主题和趋势</p>
    </header>

    <!-- 出生信息表单 -->
    <div class="birth-info-form">
        <div class="form-row">
            <div class="form-group">
                <label for="birthDate">出生日期</label>
                <input type="date" id="birthDate">
            </div>
            <div class="form-group">
                <label for="birthTime">出生时间</label>
                <input type="time" id="birthTime" value="12:00">
            </div>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label for="birthPlace">出生地点</label>
                <input type="text" id="birthPlace" placeholder="城市名称，如：北京">
            </div>
            <div class="form-group">
                <label for="returnYear">返照年份</label>
                <input type="number" id="returnYear" placeholder="留空则为当前年份">
            </div>
        </div>
        <button class="calculate-btn" id="calculateBtn">计算太阳返照盘</button>
    </div>

    <!-- 控制按钮 -->
    <div class="controls">
        <button class="control-btn" id="rotateBtn">旋转星盘</button>
        <button class="control-btn" id="resetBtn">重置视图</button>
    </div>

    <!-- 星盘容器 -->
    <div class="chart-container" id="chartContainer">
        <div class="chart-base" id="chartBase">
            <!-- 宫位环 -->
            <div class="houses-ring" id="housesRing"></div>
            <!-- 星座环 -->
            <div class="zodiac-ring" id="zodiacRing"></div>
            <!-- 行星环 -->
            <div class="planets-ring" id="planetsRing"></div>
            <!-- 星盘中心 -->
            <div class="chart-center">
                <span id="ascendantValue">上升</span>
            </div>
            <!-- 方向标记 -->
            <div class="direction direction-north">北</div>
            <div class="direction direction-south">南</div>
            <div class="direction direction-east">东</div>
            <div class="direction direction-west">西</div>
        </div>
    </div>

    <!-- 信息面板 -->
    <div class="info-content">
        <div class="info-tabs">
            <button class="info-tab active" data-tab="overview">概览</button>
            <button class="info-tab" data-tab="zodiac">星座解析</button>
            <button class="info-tab" data-tab="houses">宫位解析</button>
            <button class="info-tab" data-tab="planets">行星解析</button>
        </div>
        
        <div id="overview" class="tab-content active">
            <div class="info-header">
                <div class="info-icon">✨</div>
                <div class="info-title">
                    <div class="info-name">太阳返照盘概览</div>
                    <div class="info-details">年度运势预测</div>
                </div>
            </div>
            <div class="info-text">
                <p>太阳返照盘是每年太阳回到出生时相同位置时形成的星盘，被视为一年运势的重要参考。</p>
                <p id="chartSummary">请输入出生信息并点击计算按钮以获取详细分析。</p>
            </div>
        </div>
        
        <div id="zodiac" class="tab-content">
            <div class="info-header">
                <div class="info-icon">♈</div>
                <div class="info-title">
                    <div class="info-name">星座解析</div>
                    <div class="info-details">十二宫位的影响</div>
                </div>
            </div>
            <div class="info-text">
                <p>点击星盘上的星座区域查看详细解析。</p>
                <div id="zodiacInfo"></div>
            </div>
        </div>
        
        <div id="houses" class="tab-content">
            <div class="info-header">
                <div class="info-icon">🏠</div>
                <div class="info-title">
                    <div class="info-name">宫位解析</div>
                    <div class="info-details">人生各个领域</div>
                </div>
            </div>
            <div class="info-text">
                <p>点击星盘上的宫位区域查看详细解析。</p>
                <div id="houseInfo"></div>
            </div>
        </div>
        
        <div id="planets" class="tab-content">
            <div class="info-header">
                <div class="info-icon">🪐</div>
                <div class="info-title">
                    <div class="info-name">行星解析</div>
                    <div class="info-details">天体运行的影响</div>
                </div>
            </div>
            <div class="info-text">
                <p>点击星盘上的行星查看详细解析。</p>
                <div id="planetInfo"></div>
            </div>
        </div>
    </div>

    <script>
        // 星座数据
        const zodiacSigns = [
            { name: "白羊座", symbol: "♈", color: "#ff6b6b" },
            { name: "金牛座", symbol: "♉", color: "#48dbfb" },
            { name: "双子座", symbol: "♊", color: "#1dd1a1" },
            { name: "巨蟹座", symbol: "♋", color: "#feca57" },
            { name: "狮子座", symbol: "♌", color: "#ff9ff3" },
            { name: "处女座", symbol: "♍", color: "#5f27cd" },
            { name: "天秤座", symbol: "♎", color: "#10ac84" },
            { name: "天蝎座", symbol: "♏", color: "#ee5253" },
            { name: "射手座", symbol: "♐", color: "#0abde3" },
            { name: "摩羯座", symbol: "♑", color: "#10ac84" },
            { name: "水瓶座", symbol: "♒", color: "#5f27cd" },
            { name: "双鱼座", symbol: "♓", color: "#ff9ff3" }
        ];

        // 行星数据
        const planets = [
            { name: "太阳", symbol: "☉", color: "#feca57" },
            { name: "月亮", symbol: "☽", color: "#dfe6e9" },
            { name: "水星", symbol: "☿", color: "#a4b0be" },
            { name: "金星", symbol: "♀", color: "#ff9ff3" },
            { name: "火星", symbol: "♂", color: "#ee5253" },
            { name: "木星", symbol: "♃", color: "#10ac84" },
            { name: "土星", symbol: "♄", color: "#0abde3" },
            { name: "天王星", symbol: "♅", color: "#5f27cd" },
            { name: "海王星", symbol: "♆", color: "#48dbfb" }
        ];

        // 宫位数据
        const houses = [
            { number: 1, name: "第一宫", meaning: "自我、外貌、性格" },
            { number: 2, name: "第二宫", meaning: "财富、物质、价值观" },
            { number: 3, name: "第三宫", meaning: "沟通、学习、短途旅行" },
            { number: 4, name: "第四宫", meaning: "家庭、根源、内在安全感" },
            { number: 5, name: "第五宫", meaning: "创造力、爱情、娱乐" },
            { number: 6, name: "第六宫", meaning: "健康、工作、日常习惯" },
            { number: 7, name: "第七宫", meaning: "关系、合作、伴侣" },
            { number: 8, name: "第八宫", meaning: "转变、共享资源、神秘" },
            { number: 9, name: "第九宫", meaning: "哲学、高等教育、长途旅行" },
            { number: 10, name: "第十宫", meaning: "事业、声誉、社会地位" },
            { number: 11, name: "第十一宫", meaning: "朋友、团体、理想" },
            { number: 12, name: "第十二宫", meaning: "潜意识、独处、隐藏的事物" }
        ];

        // 生成星座信息显示
        function showZodiacInfo(zodiacIndex) {
            const zodiacInfo = document.getElementById('zodiacInfo');
            const zodiac = zodiacSigns[zodiacIndex];
            zodiacInfo.innerHTML = `
                <div class="info-card">
                    <h4 class="info-card-title" style="color: ${zodiac.color};">${zodiac.symbol} ${zodiac.name}</h4>
                    <p>太阳返照盘中，${zodiac.name}的能量将在未来一年对你产生重要影响。这一时期可能是你展现${zodiac.name}特质的关键阶段。</p>
                    <p>请关注与${zodiac.name}相关的生活领域，把握这一年的机遇与挑战。</p>
                </div>
            `;
        }

        // 生成宫位信息显示
        function showHouseInfo(houseNumber) {
            const houseInfo = document.getElementById('houseInfo');
            const house = houses[houseNumber - 1];
            houseInfo.innerHTML = `
                <div class="info-card">
                    <h4 class="info-card-title" style="color: #3b82f6;">第${house.number}宫：${house.name}</h4>
                    <p>在太阳返照盘中，第${house.number}宫代表的${house.meaning}领域将是你未来一年的重点关注方向。</p>
                    <p>这一宫位的行星配置将揭示你在该领域可能经历的变化和发展。</p>
                </div>
            `;
        }

        // 生成行星信息显示
        function showPlanetInfo(planetIndex) {
            const planetInfo = document.getElementById('planetInfo');
            const planet = planets[planetIndex];
            planetInfo.innerHTML = `
                <div class="info-card">
                    <h4 class="info-card-title" style="color: ${planet.color};">${planet.symbol} ${planet.name}</h4>
                    <p>在太阳返照盘中，${planet.name}的位置揭示了未来一年中你在${planet.name}所代表领域的主要趋势和挑战。</p>
                    <p>观察${planet.name}与其他行星的相位关系，将帮助你更全面地理解这一年的能量流动。</p>
                </div>
            `;
        }

        // 根据度数获取星座
        function getZodiacByDegrees(degrees) {
            const index = Math.floor(degrees / 30) % 12;
            return zodiacSigns[index];
        }

        // 切换信息选项卡
        function switchTab(tabId) {
            const tabs = document.querySelectorAll('.info-tab');
            const contents = document.querySelectorAll('.tab-content');
            
            tabs.forEach(tab => tab.classList.remove('active'));
            contents.forEach(content => content.classList.remove('active'));
            
            document.querySelector(`.info-tab[data-tab="${tabId}"]`).classList.add('active');
            document.getElementById(tabId).classList.add('active');
        }

        // 旋转星盘
        function rotateChart(degrees) {
            const chartBase = document.getElementById('chartBase');
            const currentRotation = getComputedStyle(chartBase).transform;
            
            let matrix = new DOMMatrix(currentRotation);
            let angle = Math.atan2(matrix.b, matrix.a) * 180 / Math.PI;
            
            angle += degrees;
            chartBase.style.transform = `rotate(${angle}deg)`;
        }

        // 计算太阳返照盘
        function calculateSolarReturnChart() {
            const birthDate = document.getElementById('birthDate').value;
            const birthTime = document.getElementById('birthTime').value;
            const birthPlace = document.getElementById('birthPlace').value;
            let returnYear = document.getElementById('returnYear').value;
            
            if (!birthDate) {
                alert('请输入出生日期');
                return;
            }
            
            if (!birthTime) {
                alert('请输入出生时间');
                return;
            }
            
            if (!birthPlace) {
                alert('请输入出生地点');
                return;
            }
            
            // 如果没有指定返照年份，使用当前年份
            if (!returnYear) {
                returnYear = new Date().getFullYear();
            }
            
            // 模拟计算结果（实际应用中应使用天文算法）
            const birthDateObj = new Date(birthDate);
            const birthMonth = birthDateObj.getMonth();
            const birthDay = birthDateObj.getDate();
            const returnDate = new Date(returnYear, birthMonth, birthDay);
            
            // 显示计算结果
            document.getElementById('chartSummary').innerHTML = `
                <p><strong>计算信息：</strong></p>
                <p>出生日期：${birthDate}</p>
                <p>出生时间：${birthTime}</p>
                <p>出生地点：${birthPlace}</p>
                <p>返照年份：${returnYear}</p>
                <p>太阳返照日期：${returnDate.getFullYear()}-${String(returnDate.getMonth() + 1).padStart(2, '0')}-${String(returnDate.getDate()).padStart(2, '0')}</p>
                <p style="margin-top: 15px;"><strong>太阳返照盘解读：</strong></p>
                <p>在${returnYear}年的太阳返照盘中，太阳位于${getZodiacByDegrees(Math.random() * 360).name}，这意味着你将在这一年更加关注${getZodiacByDegrees(Math.random() * 360).name}所代表的领域。</p>
                <p>通过分析星盘中行星的位置和相位，可以深入了解你在职业、关系、健康和个人成长等方面可能面临的机遇与挑战。</p>
            `;
            
            // 渲染星盘
            renderChart();
        }

        // 渲染星盘
        function renderChart() {
            const housesRing = document.getElementById('housesRing');
            const zodiacRing = document.getElementById('zodiacRing');
            const planetsRing = document.getElementById('planetsRing');
            
            // 清空现有内容
            housesRing.innerHTML = '';
            zodiacRing.innerHTML = '';
            planetsRing.innerHTML = '';
            
            // 生成宫位
            const houseAngle = 30; // 每个宫位30度
            for (let i = 0; i < 12; i++) {
                const house = document.createElement('div');
                house.classList.add('house');
                house.style.transform = `rotate(${i * houseAngle}deg)`;
                
                // 创建宫位标签
                const houseNumber = document.createElement('div');
                houseNumber.classList.add('house-number');
                houseNumber.style.position = 'absolute';
                houseNumber.style.top = '10%';
                houseNumber.style.left = '50%';
                houseNumber.style.transform = 'translate(-50%, -50%) rotate(-' + (i * houseAngle) + 'deg)';
                houseNumber.style.color = '#ffffff';
                houseNumber.style.fontSize = '1rem';
                houseNumber.style.fontWeight = 'bold';
                houseNumber.textContent = (i + 1);
                
                house.appendChild(houseNumber);
                house.addEventListener('click', () => {
                    showHouseInfo(i + 1);
                    switchTab('houses');
                });
                housesRing.appendChild(house);
            }
            
            // 生成星座
            const zodiacAngle = 30; // 每个星座30度
            for (let i = 0; i < 12; i++) {
                const zodiac = document.createElement('div');
                zodiac.classList.add('zodiac-sector');
                zodiac.style.transform = `rotate(${i * zodiacAngle}deg)`;
                zodiac.style.background = `linear-gradient(45deg, rgba(0,0,0,0.1), ${zodiacSigns[i].color}40)`;
                
                // 创建星座符号
                const sign = document.createElement('div');
                sign.classList.add('zodiac-sign');
                sign.style.top = '30%';
                sign.style.left = '50%';
                sign.style.transform = `translate(-50%, -50%) rotate(-${i * zodiacAngle}deg)`;
                sign.textContent = zodiacSigns[i].symbol;
                sign.style.color = zodiacSigns[i].color;
                
                zodiac.appendChild(sign);
                zodiac.addEventListener('click', () => {
                    showZodiacInfo(i);
                    switchTab('zodiac');
                });
                zodiacRing.appendChild(zodiac);
            }
            
            // 生成行星
            for (let i = 0; i < planets.length; i++) {
                const planet = document.createElement('div');
                planet.classList.add('planet');
                
                // 随机位置（实际应用中应根据计算结果）
                const angle = Math.random() * 360;
                const radius = 65; // 行星环半径百分比
                
                const radians = angle * Math.PI / 180;
                const centerX = 50;
                const centerY = 50;
                const x = centerX + radius * Math.cos(radians);
                const y = centerY + radius * Math.sin(radians);
                
                planet.style.left = `${x}%`;
                planet.style.top = `${y}%`;
                planet.style.background = planets[i].color;
                planet.textContent = planets[i].symbol;
                
                planet.addEventListener('click', () => {
                    showPlanetInfo(i);
                    switchTab('planets');
                });
                planetsRing.appendChild(planet);
            }
            
            // 随机生成上升星座（实际应用中应根据计算结果）
            const ascendantDegree = Math.random() * 360;
            const ascendantZodiac = getZodiacByDegrees(ascendantDegree);
            document.getElementById('ascendantValue').textContent = `${ascendantZodiac.symbol} ${Math.round(ascendantDegree)}°`;
        }

        // 创建星星背景
        function createStars() {
            const starsContainer = document.querySelector('.stars');
            const starCount = 150; // 星星数量
            
            for (let i = 0; i < starCount; i++) {
                const star = document.createElement('div');
                star.classList.add('star');
                
                // 随机位置
                const x = Math.random() * 100;
                const y = Math.random() * 100;
                
                // 随机大小
                const size = Math.random() * 2 + 0.5;
                
                // 随机动画延迟
                const delay = Math.random() * 2;
                
                // 设置样式
                star.style.left = `${x}%`;
                star.style.top = `${y}%`;
                star.style.width = `${size}px`;
                star.style.height = `${size}px`;
                star.style.animationDelay = `${delay}s`;
                
                starsContainer.appendChild(star);
            }
        }

        // 优化滑动体验
        function optimizeScrolling() {
            // 移除阻止默认滚动行为的代码，允许信息选项卡区域自然滚动
            // 为信息选项卡区域添加横向滚动支持
            const infoTabs = document.querySelector('.info-tabs');
            if (infoTabs) {
                infoTabs.style.scrollBehavior = 'smooth';
            }
        }

        // 添加事件监听器
        function addEventListeners() {
            // 计算按钮
            document.getElementById('calculateBtn').addEventListener('click', calculateSolarReturnChart);
            
            // 控制按钮
            document.getElementById('rotateBtn').addEventListener('click', () => rotateChart(90));
            document.getElementById('resetBtn').addEventListener('click', () => {
                document.getElementById('chartBase').style.transform = 'rotate(0deg)';
            });
            
            // 信息选项卡
            document.querySelectorAll('.info-tab').forEach(tab => {
                tab.addEventListener('click', () => {
                    const tabId = tab.getAttribute('data-tab');
                    switchTab(tabId);
                });
            });
            
            // 自动设置默认日期
            setDefaultDate();
        }

        // 设置默认日期为今天
        function setDefaultDate() {
            const today = new Date();
            const year = today.getFullYear();
            const month = String(today.getMonth() + 1).padStart(2, '0');
            const day = String(today.getDate()).padStart(2, '0');
            const formattedDate = `${year}-${month}-${day}`;
            
            document.getElementById('birthDate').value = formattedDate;
            document.getElementById('birthTime').value = '12:00';
            document.getElementById('returnYear').value = year;
        }

        // 初始化页面
        function init() {
            createStars();
            addEventListeners();
            optimizeScrolling();
            
            // 如果是在iframe中加载，添加in-iframe类
            if (window.self !== window.top) {
                document.body.classList.add('in-iframe');
            }
        }

        // 页面加载完成后初始化
        window.addEventListener('load', init);
    </script>
</body>
</html>